home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue44 / alfresco / Project1.dpr < prev   
Encoding:
Text File  |  1999-02-28  |  2.9 KB  |  124 lines

  1. program Project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils,
  7.   Classes,
  8.   AABufStm,
  9.   AA6Pack in 'AA6Pack.pas',
  10.   AAHuffmn in 'AAHuffmn.pas';
  11.  
  12. var
  13.   InStr  : TFileStream;
  14.   OutStr : TFileStream;
  15.  
  16.   InBufStm  : TaaBufferedStream;
  17.   OutBufStm : TaaBufferedStream;
  18. begin
  19.   try
  20.     writeln('SixBitPack compression test');
  21.     writeln('Compressing...');
  22.     InStr := TFileStream.Create('LLL.TXT', fmOpenRead);
  23.     try
  24.       OutStr := TFileStream.Create('LLL.SBP', fmCreate);
  25.       try
  26.         InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
  27.         try
  28.           OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
  29.           try
  30.             SixBitPackCompress(InBufStm, OutBufStm);
  31.           finally
  32.             OutBufStm.Free;
  33.           end;
  34.         finally
  35.           InBufStm.Free;
  36.         end;
  37.       finally
  38.         OutStr.Free;
  39.       end;
  40.     finally
  41.       InStr.Free;
  42.     end;
  43.     writeln('Done');
  44.  
  45.     writeln('Decompressing...');
  46.     InStr := TFileStream.Create('LLL.SBP', fmOpenRead);
  47.     try
  48.       OutStr := TFileStream.Create('LLL.STX', fmCreate);
  49.       try
  50.         InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
  51.         try
  52.           OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
  53.           try
  54.             SixBitPackDecompress(InBufStm, OutBufStm);
  55.           finally
  56.             OutBufStm.Free;
  57.           end;
  58.         finally
  59.           InBufStm.Free;
  60.         end;
  61.       finally
  62.         OutStr.Free;
  63.       end;
  64.     finally
  65.       InStr.Free;
  66.     end;
  67.     writeln('Done');
  68.  
  69.     writeln('Huffman compression test');
  70.     writeln('Compressing...');
  71.     InStr := TFileStream.Create('LLL.TXT', fmOpenRead);
  72.     try
  73.       OutStr := TFileStream.Create('LLL.HUF', fmCreate);
  74.       try
  75.         InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
  76.         try
  77.           OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
  78.           try
  79.             HuffmanCompress(InBufStm, OutBufStm);
  80.           finally
  81.             OutBufStm.Free;
  82.           end;
  83.         finally
  84.           InBufStm.Free;
  85.         end;
  86.       finally
  87.         OutStr.Free;
  88.       end;
  89.     finally
  90.       InStr.Free;
  91.     end;
  92.     writeln('Done');
  93.  
  94.     writeln('Decompressing...');
  95.     InStr := TFileStream.Create('LLL.HUF', fmOpenRead);
  96.     try
  97.       OutStr := TFileStream.Create('LLL.HTX', fmCreate);
  98.       try
  99.         InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
  100.         try
  101.           OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
  102.           try
  103.             HuffmanDecompress(InBufStm, OutBufStm);
  104.           finally
  105.             OutBufStm.Free;
  106.           end;
  107.         finally
  108.           InBufStm.Free;
  109.         end;
  110.       finally
  111.         OutStr.Free;
  112.       end;
  113.     finally
  114.       InStr.Free;
  115.     end;
  116.     writeln('Done');
  117.   except
  118.     on E:Exception do
  119.       writeln(E.Message);
  120.   end;
  121.   readln;
  122. end.
  123.  
  124.